<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        class Cat{
            constructor(fur){
                this.fur=fur;
            }
            eat(food){
                console.log("我只吃"+food+"!");
            }
            miaow(){
                console.log("喵喵叫");
            }
        }

        class GarfieldCat extends Cat{
            constructor(fur,glasses){
                super(fur)
                this.glasses=glasses;
            }
            talk(){
                console.log("子类1的方法talk");
            }
        }

        class TomCat extends Cat{
            constructor(fur,friend){
                super(fur)
                this.friend=friend;
            }
            catchMouse(){
                console.log("子类2的方法抓老鼠");
            }
        }

        var cat1=new GarfieldCat("顺滑","漂亮");
        console.log(cat1.fur);
        cat1.miaow();
        cat1.eat("肉");
        cat1.talk();
        console.log(cat1);

        var cat2=new TomCat("粗糙","明亮");
        console.log(cat2.fur);
        cat2.miaow();
        cat2.eat("面包");
        cat2.catchMouse();
        console.log(cat2);
    </script>
</body>
</html>